---
layout: docs
page_title: Configure exit signals
description: |-
  Configure the exit signal that Nomad sends to an application to allow it
  to gracefully terminate before Nomad kills the application.
---

# Configure exit signals

On operating systems that support signals, Nomad will send the application a
configurable signal before killing it. This gives the application time to
gracefully drain connections and conduct other cleanup before shutting down.
Certain applications take longer to drain than others, and thus Nomad allows
specifying the amount of time to wait for the application to exit before
force-killing it.

Before Nomad terminates an application, it will send the `SIGINT` signal to the
process. Processes running under Nomad should respond to this signal to
gracefully drain connections. After a configurable timeout, the application
will be force-terminated.

The signal sent may be configured with the [`kill_signal`][kill_signal] task
parameter, and the timeout before the task is force-terminated may be
configured via [`kill_timeout`][kill_timeout].

```hcl
job "docs" {
  group "example" {
    task "server" {
      # ...
      kill_timeout = "45s"
    }
  }
}
```

The behavior is slightly different for Docker-based tasks. Nomad will run the
`docker stop` command with the specified `kill_timeout`. The signal that `docker stop` sends to your container entrypoint is configurable using the
[`STOPSIGNAL` configuration directive]; however, please note that the default is
`SIGTERM`.

[kill_signal]: /nomad/docs/job-specification/task#kill_signal
[kill_timeout]: /nomad/docs/job-specification/task#kill_timeout
[`stopsignal` configuration directive]: https://docs.docker.com/engine/reference/builder/#stopsignal
